public class Test2 {
    public boolean isSymmetric(TreeNode root) {
        if(root == null){
            return true;
        }
        return Solution(root.left,root.right)&&Solution(root.right,root.left);

    }
    public boolean Solution(TreeNode leftTree,TreeNode rightTree){
        if((leftTree != null)&&(rightTree == null)||(leftTree == null)&&(rightTree != null)){
            return false;
        }
        if((leftTree == null) && (rightTree == null)){
            return true;
        }
        if(leftTree.val != rightTree.val){
            return false;
        }
        return true;
    }
}
